{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "3aca170b-e268-4b0d-8046-1e2f8e27aeaa",
   "metadata": {},
   "outputs": [],
   "source": [
    "import comet_ml\n",
    "import torch\n",
    "import utils\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "9b397bcc-3df3-4fc9-980e-abd7c0595efa",
   "metadata": {},
   "outputs": [],
   "source": [
    "weight = 'base_s_16e.pt'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "149fb6fd-1e5f-4334-93f3-eb504256bd89",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "4f1f45eb-9e6f-4122-9912-9e924dcc144a",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "YOLOv5 🚀 5acf9a1c Python-3.10.8 torch-2.1.2+cu118 CUDA:0 (NVIDIA GeForce RTX 3080, 20181MiB)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Setup complete ✅ (128 CPUs, 503.5 GB RAM, 16.0/30.0 GB disk)\n"
     ]
    }
   ],
   "source": [
    "comet_ml.init(project_name='enhance_baseline_yolov5s_70%train&&30%test')\n",
    "display = utils.notebook_init()  # checks"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "95c6dd6a-ae2f-45b4-85b7-ff2c0fac7d37",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[34m\u001b[1mtrain: \u001b[0mweights=base_s_16e.pt, cfg=models/yolov5s_kitti.yaml, data=data/kitti.yaml, hyp=data/hyps/hyp.scratch-low.yaml, epochs=16, batch_size=16, imgsz=640, rect=False, resume=False, nosave=False, noval=False, noautoanchor=False, noplots=False, evolve=None, evolve_population=data/hyps, resume_evolve=None, bucket=, cache=None, image_weights=False, device=, multi_scale=False, single_cls=False, optimizer=SGD, sync_bn=False, workers=8, project=runs/train, name=exp, exist_ok=False, quad=False, cos_lr=False, label_smoothing=0.0, patience=100, freeze=[0], save_period=-1, seed=0, local_rank=-1, entity=None, upload_dataset=False, bbox_interval=1, artifact_alias=latest, ndjson_console=False, ndjson_file=False\n",
      "\u001b[34m\u001b[1mgithub: \u001b[0m⚠️ YOLOv5 is out of date by 2882 commits. Use 'git pull ultralytics master' or 'git clone https://github.com/ultralytics/yolov5' to update.\n",
      "YOLOv5 🚀 5acf9a1c Python-3.10.8 torch-2.1.2+cu118 CUDA:0 (NVIDIA GeForce RTX 3080, 20181MiB)\n",
      "\n",
      "\u001b[34m\u001b[1mhyperparameters: \u001b[0mlr0=0.01, lrf=0.01, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=0.05, cls=0.5, cls_pw=1.0, obj=1.0, obj_pw=1.0, iou_t=0.2, anchor_t=4.0, fl_gamma=0.0, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.1, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, mosaic=1.0, mixup=0.0, copy_paste=0.0\n",
      "\u001b[34m\u001b[1mTensorBoard: \u001b[0mStart with 'tensorboard --logdir runs/train', view at http://localhost:6006/\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m Experiment is live on comet.com \u001b[38;5;39mhttps://www.comet.com/nagasaki-soyorin/enhance-baseline-yolov5s-70-train-30-test/f374c4297749436793dd8189ef1a9e1d\u001b[0m\n",
      "\n",
      "\n",
      "                 from  n    params  module                                  arguments                     \n",
      "  0                -1  1      3520  models.common.Conv                      [3, 32, 6, 2, 2]              \n",
      "  1                -1  1     18560  models.common.Conv                      [32, 64, 3, 2]                \n",
      "  2                -1  1     18816  models.common.C3                        [64, 64, 1]                   \n",
      "  3                -1  1     73984  models.common.Conv                      [64, 128, 3, 2]               \n",
      "  4                -1  2    115712  models.common.C3                        [128, 128, 2]                 \n",
      "  5                -1  1    295424  models.common.Conv                      [128, 256, 3, 2]              \n",
      "  6                -1  3    625152  models.common.C3                        [256, 256, 3]                 \n",
      "  7                -1  1   1180672  models.common.Conv                      [256, 512, 3, 2]              \n",
      "  8                -1  1   1182720  models.common.C3                        [512, 512, 1]                 \n",
      "  9                -1  1    656896  models.common.SPPF                      [512, 512, 5]                 \n",
      " 10                -1  1    131584  models.common.Conv                      [512, 256, 1, 1]              \n",
      " 11                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          \n",
      " 12           [-1, 6]  1         0  models.common.Concat                    [1]                           \n",
      " 13                -1  1    361984  models.common.C3                        [512, 256, 1, False]          \n",
      " 14                -1  1     33024  models.common.Conv                      [256, 128, 1, 1]              \n",
      " 15                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          \n",
      " 16           [-1, 4]  1         0  models.common.Concat                    [1]                           \n",
      " 17                -1  1     90880  models.common.C3                        [256, 128, 1, False]          \n",
      " 18                -1  1    147712  models.common.Conv                      [128, 128, 3, 2]              \n",
      " 19          [-1, 14]  1         0  models.common.Concat                    [1]                           \n",
      " 20                -1  1    296448  models.common.C3                        [256, 256, 1, False]          \n",
      " 21                -1  1    590336  models.common.Conv                      [256, 256, 3, 2]              \n",
      " 22          [-1, 10]  1         0  models.common.Concat                    [1]                           \n",
      " 23                -1  1   1182720  models.common.C3                        [512, 512, 1, False]          \n",
      " 24      [17, 20, 23]  1     35061  models.yolo.Detect                      [8, [[10, 13, 16, 30, 33, 23], [30, 61, 62, 45, 59, 119], [116, 90, 156, 198, 373, 326]], [128, 256, 512]]\n",
      "YOLOv5s_kitti summary: 214 layers, 7041205 parameters, 7041205 gradients, 16.0 GFLOPs\n",
      "\n",
      "Transferred 348/349 items from base_s_16e.pt\n",
      "\u001b[34m\u001b[1mAMP: \u001b[0mchecks passed ✅\n",
      "\u001b[34m\u001b[1moptimizer:\u001b[0m SGD(lr=0.01) with parameter groups 57 weight(decay=0.0), 60 weight(decay=0.0005), 60 bias\n",
      "\u001b[34m\u001b[1malbumentations: \u001b[0m1 validation error for InitSchema\n",
      "size\n",
      "  Field required [type=missing, input_value={'height': 640, 'width': ...'mask_interpolation': 0}, input_type=dict]\n",
      "    For further information visit https://errors.pydantic.dev/2.10/v/missing\n",
      "\u001b[34m\u001b[1mtrain: \u001b[0mScanning /root/autodl-tmp/datasets/kitti/labels/train.cache... 4189 image\u001b[0m\n",
      "\u001b[34m\u001b[1mval: \u001b[0mScanning /root/autodl-tmp/datasets/kitti/labels/val.cache... 1048 images, 0\u001b[0m\n",
      "\n",
      "\u001b[34m\u001b[1mAutoAnchor: \u001b[0m4.81 anchors/target, 0.999 Best Possible Recall (BPR). Current anchors are a good fit to dataset ✅\n",
      "Plotting labels to runs/train/exp3/labels.jpg... \n",
      "Image sizes 640 train, 640 val\n",
      "Using 8 dataloader workers\n",
      "Logging results to \u001b[1mruns/train/exp3\u001b[0m\n",
      "Starting training for 16 epochs...\n",
      "\n",
      "      Epoch    GPU_mem   box_loss   obj_loss   cls_loss  Instances       Size\n",
      "       0/15      3.65G    0.03372    0.03152   0.005805        128        640: 1\n",
      "                 Class     Images  Instances          P          R      mAP50   \n",
      "                   all       1048       5675      0.839      0.758      0.821      0.502\n",
      "\n",
      "      Epoch    GPU_mem   box_loss   obj_loss   cls_loss  Instances       Size\n",
      "       1/15      3.65G    0.03716    0.03124   0.006007        133        640: 1\n",
      "                 Class     Images  Instances          P          R      mAP50   \n",
      "                   all       1048       5675      0.816      0.715      0.786       0.43\n",
      "\n",
      "      Epoch    GPU_mem   box_loss   obj_loss   cls_loss  Instances       Size\n",
      "       2/15      3.65G    0.04007     0.0323   0.006506        131        640: 1\n",
      "                 Class     Images  Instances          P          R      mAP50   \n",
      "                   all       1048       5675      0.784      0.708      0.766       0.39\n",
      "\n",
      "      Epoch    GPU_mem   box_loss   obj_loss   cls_loss  Instances       Size\n",
      "       3/15      3.65G       0.04    0.03257   0.006634        108        640: 1\n",
      "                 Class     Images  Instances          P          R      mAP50   \n",
      "                   all       1048       5675       0.77      0.682      0.761      0.433\n",
      "\n",
      "      Epoch    GPU_mem   box_loss   obj_loss   cls_loss  Instances       Size\n",
      "       4/15      3.65G    0.03967    0.03234   0.006644        156        640: 1\n",
      "                 Class     Images  Instances          P          R      mAP50   \n",
      "                   all       1048       5675      0.806      0.658      0.742      0.408\n",
      "\n",
      "      Epoch    GPU_mem   box_loss   obj_loss   cls_loss  Instances       Size\n",
      "       5/15      3.65G     0.0385    0.03196   0.006422        123        640: 1\n",
      "                 Class     Images  Instances          P          R      mAP50   \n",
      "                   all       1048       5675      0.828      0.712      0.771      0.434\n",
      "\n",
      "      Epoch    GPU_mem   box_loss   obj_loss   cls_loss  Instances       Size\n",
      "       6/15      3.65G      0.037    0.03114   0.005942        174        640: 1\n",
      "                 Class     Images  Instances          P          R      mAP50   \n",
      "                   all       1048       5675      0.857       0.73      0.812      0.483\n",
      "\n",
      "      Epoch    GPU_mem   box_loss   obj_loss   cls_loss  Instances       Size\n",
      "       7/15      3.65G    0.03626    0.03051    0.00556        166        640: 1\n",
      "                 Class     Images  Instances          P          R      mAP50   \n",
      "                   all       1048       5675       0.85      0.714       0.79       0.46\n",
      "\n",
      "      Epoch    GPU_mem   box_loss   obj_loss   cls_loss  Instances       Size\n",
      "       8/15      3.65G    0.03522    0.03062    0.00528        152        640: 1\n",
      "                 Class     Images  Instances          P          R      mAP50   \n",
      "                   all       1048       5675      0.871      0.734      0.814      0.491\n",
      "\n",
      "      Epoch    GPU_mem   box_loss   obj_loss   cls_loss  Instances       Size\n",
      "       9/15      3.65G    0.03429     0.0301   0.005138        136        640: 1\n",
      "                 Class     Images  Instances          P          R      mAP50   \n",
      "                   all       1048       5675      0.843      0.758      0.818      0.489\n",
      "\n",
      "      Epoch    GPU_mem   box_loss   obj_loss   cls_loss  Instances       Size\n",
      "      10/15      3.65G    0.03342    0.02962   0.004729        134        640: 1\n",
      "                 Class     Images  Instances          P          R      mAP50   \n",
      "                   all       1048       5675      0.866      0.734      0.804      0.503\n",
      "\n",
      "      Epoch    GPU_mem   box_loss   obj_loss   cls_loss  Instances       Size\n",
      "      11/15      3.65G    0.03242    0.02876   0.004415        182        640: 1\n",
      "                 Class     Images  Instances          P          R      mAP50   \n",
      "                   all       1048       5675      0.875      0.768      0.843      0.516\n",
      "\n",
      "      Epoch    GPU_mem   box_loss   obj_loss   cls_loss  Instances       Size\n",
      "      12/15      3.65G    0.03159     0.0288    0.00428        128        640: 1\n",
      "                 Class     Images  Instances          P          R      mAP50   \n",
      "                   all       1048       5675      0.883      0.762      0.844      0.537\n",
      "\n",
      "      Epoch    GPU_mem   box_loss   obj_loss   cls_loss  Instances       Size\n",
      "      13/15      3.65G    0.03077    0.02798   0.003954        112        640: 1\n",
      "                 Class     Images  Instances          P          R      mAP50   \n",
      "                   all       1048       5675      0.884      0.769      0.845      0.537\n",
      "\n",
      "      Epoch    GPU_mem   box_loss   obj_loss   cls_loss  Instances       Size\n",
      "      14/15      3.65G    0.03024    0.02782   0.003815        151        640: 1\n",
      "                 Class     Images  Instances          P          R      mAP50   \n",
      "                   all       1048       5675      0.876      0.788      0.852      0.557\n",
      "\n",
      "      Epoch    GPU_mem   box_loss   obj_loss   cls_loss  Instances       Size\n",
      "      15/15      3.65G    0.03004     0.0278     0.0037        132        640: 1\n",
      "                 Class     Images  Instances          P          R      mAP50   \n",
      "                   all       1048       5675      0.868       0.78      0.847      0.554\n",
      "\n",
      "16 epochs completed in 0.176 hours.\n",
      "Optimizer stripped from runs/train/exp3/weights/last.pt, 14.3MB\n",
      "Optimizer stripped from runs/train/exp3/weights/best.pt, 14.3MB\n",
      "\n",
      "Validating runs/train/exp3/weights/best.pt...\n",
      "Fusing layers... \n",
      "YOLOv5s_kitti summary: 157 layers, 7031701 parameters, 0 gradients, 15.8 GFLOPs\n",
      "                 Class     Images  Instances          P          R      mAP50   \n",
      "                   all       1048       5675      0.876      0.788      0.852      0.556\n",
      "                   Car       1048       4012      0.919      0.891      0.949      0.702\n",
      "                   Van       1048        431      0.879       0.89      0.932      0.682\n",
      "                 Truck       1048        166      0.925      0.892      0.948      0.702\n",
      "                  Tram       1048         56      0.832      0.911      0.938      0.656\n",
      "            Pedestrian       1048        618      0.831      0.703      0.785      0.403\n",
      "        Person_sitting       1048         20      0.839      0.522      0.607      0.297\n",
      "               Cyclist       1048        234      0.884      0.795      0.848      0.501\n",
      "                  Misc       1048        138      0.899      0.703      0.808      0.506\n",
      "Results saved to \u001b[1mruns/train/exp3\u001b[0m\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m ---------------------------------------------------------------------------------------\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m Comet.ml Experiment Summary\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m ---------------------------------------------------------------------------------------\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m   Data:\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     display_summary_level : 1\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     name                  : exp\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     url                   : \u001b[38;5;39mhttps://www.comet.com/nagasaki-soyorin/enhance-baseline-yolov5s-70-train-30-test/f374c4297749436793dd8189ef1a9e1d\u001b[0m\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m   Metrics [count] (min, max):\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Car_f1                         : 0.9047199244979605\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Car_false_positives            : 314.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Car_mAP@.5                     : 0.9493711784133896\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Car_mAP@.5:.95                 : 0.7022934124527278\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Car_precision                  : 0.9193179465820126\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Car_recall                     : 0.8905782652043869\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Car_support                    : 4012\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Car_true_positives             : 3573.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Cyclist_f1                     : 0.8372144698016359\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Cyclist_false_positives        : 24.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Cyclist_mAP@.5                 : 0.8478806898196856\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Cyclist_mAP@.5:.95             : 0.5011557810193125\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Cyclist_precision              : 0.8843221486966457\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Cyclist_recall                 : 0.7948717948717948\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Cyclist_support                : 234\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Cyclist_true_positives         : 186.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Misc_f1                        : 0.7889860013742742\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Misc_false_positives           : 11.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Misc_mAP@.5                    : 0.8077000942424453\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Misc_mAP@.5:.95                : 0.50589589243211\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Misc_precision                 : 0.8991036588682833\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Misc_recall                    : 0.7028985507246377\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Misc_support                   : 138\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Misc_true_positives            : 97.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Pedestrian_f1                  : 0.7615709390243838\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Pedestrian_false_positives     : 88.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Pedestrian_mAP@.5              : 0.7850289113172456\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Pedestrian_mAP@.5:.95          : 0.40296474741450494\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Pedestrian_precision           : 0.8314673141453506\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Pedestrian_recall              : 0.7025148125471751\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Pedestrian_support             : 618\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Pedestrian_true_positives      : 434.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Person_sitting_f1              : 0.6432953533963437\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Person_sitting_false_positives : 2.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Person_sitting_mAP@.5          : 0.6074577902343486\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Person_sitting_mAP@.5:.95      : 0.296700186327616\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Person_sitting_precision       : 0.8388885114375311\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Person_sitting_recall          : 0.5216651946063711\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Person_sitting_support         : 20\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Person_sitting_true_positives  : 10.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Tram_f1                        : 0.8697378741197188\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Tram_false_positives           : 10.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Tram_mAP@.5                    : 0.9384715567783692\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Tram_mAP@.5:.95                : 0.6555547139488299\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Tram_precision                 : 0.8322900591835313\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Tram_recall                    : 0.9107142857142857\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Tram_support                   : 56\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Tram_true_positives            : 51.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Truck_f1                       : 0.9078114501899933\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Truck_false_positives          : 12.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Truck_mAP@.5                   : 0.9479089737921371\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Truck_mAP@.5:.95               : 0.7021490110840278\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Truck_precision                : 0.9246596278580287\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Truck_recall                   : 0.891566265060241\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Truck_support                  : 166\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Truck_true_positives           : 148.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Van_f1                         : 0.884183431525409\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Van_false_positives            : 53.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Van_mAP@.5                     : 0.9319347057479799\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Van_mAP@.5:.95                 : 0.6822912392687523\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Van_precision                  : 0.8785867298238973\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Van_recall                     : 0.889851893656998\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Van_support                    : 431\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Van_true_positives             : 384.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     loss [418]                     : (0.783413290977478, 1.5672626495361328)\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     metrics/mAP_0.5 [32]           : (0.7417458239176237, 0.852030505203657)\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     metrics/mAP_0.5:0.95 [32]      : (0.39009395028875593, 0.5566846260947277)\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     metrics/precision [32]         : (0.7700019473567661, 0.8840387936601111)\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     metrics/recall [32]            : (0.6582058538539256, 0.7879173930263965)\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     train/box_loss [32]            : (0.03003823757171631, 0.04006566107273102)\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     train/cls_loss [32]            : (0.003700016299262643, 0.006643541622906923)\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     train/obj_loss [32]            : (0.027800479903817177, 0.03256561607122421)\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     val/box_loss [32]              : (0.02914123609662056, 0.037153784185647964)\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     val/cls_loss [32]              : (0.0037778273690491915, 0.006431370973587036)\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     val/obj_loss [32]              : (0.043070707470178604, 0.048796914517879486)\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     x/lr0 [32]                     : (0.0013375000000000001, 0.07011450381679389)\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     x/lr1 [32]                     : (0.0013375000000000001, 0.008751351781170483)\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     x/lr2 [32]                     : (0.0013375000000000001, 0.008751351781170483)\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m   Others:\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Name                        : exp\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     Run Path                    : nagasaki-soyorin/enhance-baseline-yolov5s-70-train-30-test/f374c4297749436793dd8189ef1a9e1d\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     comet_log_batch_metrics     : False\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     comet_log_confusion_matrix  : True\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     comet_log_per_class_metrics : True\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     comet_max_image_uploads     : 100\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     comet_mode                  : online\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     comet_model_name            : yolov5\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hasNestedParams             : True\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m   Parameters:\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     anchor_t            : 4.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     artifact_alias      : latest\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     batch_size          : 16\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     box                 : 0.05\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     bucket              : \n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     cache               : None\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     cls                 : 0.05000000000000001\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     cls_pw              : 1.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     copy_paste          : 0.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     cos_lr              : False\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     degrees             : 0.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     device              : \n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     entity              : None\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     evolve              : None\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     evolve_population   : data/hyps\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     exist_ok            : False\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     fl_gamma            : 0.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     fliplr              : 0.5\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     flipud              : 0.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     freeze              : [0]\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hsv_h               : 0.015\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hsv_s               : 0.7\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hsv_v               : 0.4\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|anchor_t        : 4.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|box             : 0.05\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|cls             : 0.5\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|cls_pw          : 1.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|copy_paste      : 0.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|degrees         : 0.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|fl_gamma        : 0.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|fliplr          : 0.5\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|flipud          : 0.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|hsv_h           : 0.015\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|hsv_s           : 0.7\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|hsv_v           : 0.4\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|iou_t           : 0.2\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|lr0             : 0.01\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|lrf             : 0.01\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|mixup           : 0.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|momentum        : 0.937\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|mosaic          : 1.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|obj             : 1.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|obj_pw          : 1.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|perspective     : 0.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|scale           : 0.5\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|shear           : 0.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|translate       : 0.1\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|warmup_bias_lr  : 0.1\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|warmup_epochs   : 3.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|warmup_momentum : 0.8\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     hyp|weight_decay    : 0.0005\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     image_weights       : False\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     imgsz               : 640\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     iou_t               : 0.2\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     label_smoothing     : 0.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     local_rank          : -1\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     lr0                 : 0.01\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     lrf                 : 0.01\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     mixup               : 0.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     momentum            : 0.937\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     mosaic              : 1.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     multi_scale         : False\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     name                : exp\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     ndjson_console      : False\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     ndjson_file         : False\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     noautoanchor        : False\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     noplots             : False\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     nosave              : False\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     noval               : False\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     obj                 : 1.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     obj_pw              : 1.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     optimizer           : SGD\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     patience            : 100\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     perspective         : 0.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     project             : runs/train\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     quad                : False\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     rect                : False\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     resume              : False\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     resume_evolve       : None\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     save_dir            : runs/train/exp3\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     save_period         : -1\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     scale               : 0.5\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     seed                : 0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     shear               : 0.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     single_cls          : False\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     sync_bn             : False\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     translate           : 0.1\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     upload_dataset      : False\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     val_conf_threshold  : 0.001\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     val_iou_threshold   : 0.6\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     warmup_bias_lr      : 0.1\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     warmup_epochs       : 3.0\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     warmup_momentum     : 0.8\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     weight_decay        : 0.0005\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     workers             : 8\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m   Uploads:\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     asset                        : 13 (1.93 MB)\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     conda-environment-definition : 1\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     conda-info                   : 1\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     conda-specification          : 1\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     confusion-matrix             : 1\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     environment details          : 1\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     git metadata                 : 1\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     images                       : 106\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     installed packages           : 1\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     model graph                  : 1\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m     os packages                  : 1\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m \n"
     ]
    }
   ],
   "source": [
    "command = f\"\"\"\n",
    "env COMET_LOG_PER_CLASS_METRICS=true python train.py \\\n",
    "--img 640 \\\n",
    "--bbox_interval 1 \\\n",
    "--cfg models/yolov5s_kitti.yaml \\\n",
    "--data data/kitti.yaml \\\n",
    "--weights {weight} \\\n",
    "--epochs 16 \\\n",
    "\"\"\"\n",
    "!{command}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e89b25b1-ce29-4cbd-b8c3-e51da5cc8d13",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "56002593-c5e8-44d9-8ea5-118abd1a960d",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "735f12c9-277b-47bd-aebd-f99f90ec142e",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "91451c02-9efc-441c-bddf-549d008523a1",
   "metadata": {},
   "outputs": [],
   "source": [
    "model_name = 'e_base_s_16e.pt'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "c3636066-2d56-497f-9a60-d0fe877f8722",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Test set updated successfully!\n"
     ]
    }
   ],
   "source": [
    "update_testsets = f\" \\\n",
    "rm ../datasets/kitti/images/test/* &&\\\n",
    "cp ../testing/image_2/* ../datasets/kitti/images/test/ && \\\n",
    "echo 'Test set updated successfully!' \\\n",
    "\" \n",
    "!{update_testsets}\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "a98aefbd-3cd2-4e66-92ab-fb06da79b83f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[34m\u001b[1mval: \u001b[0mdata=data/kitti.yaml, weights=['e_base_s_16e.pt'], batch_size=32, imgsz=640, conf_thres=0.001, iou_thres=0.6, max_det=300, task=test, device=, workers=8, single_cls=False, augment=False, verbose=False, save_txt=False, save_hybrid=False, save_conf=False, save_json=False, project=runs/val, name=exp, exist_ok=False, half=False, dnn=False\n",
      "YOLOv5 🚀 5acf9a1c Python-3.10.8 torch-2.1.2+cu118 CUDA:0 (NVIDIA GeForce RTX 3080, 20181MiB)\n",
      "\n",
      "Fusing layers... \n",
      "YOLOv5s_kitti summary: 157 layers, 7031701 parameters, 0 gradients, 15.8 GFLOPs\n",
      "\u001b[34m\u001b[1mtest: \u001b[0mScanning /root/autodl-tmp/datasets/kitti/labels/test.cache... 2244 images,\u001b[0m\n",
      "                 Class     Images  Instances          P          R      mAP50   \n",
      "                   all       2244      12198      0.875      0.787      0.858      0.553\n",
      "                   Car       2244       8711      0.922      0.877      0.948      0.701\n",
      "                   Van       2244        861      0.887      0.827      0.898      0.645\n",
      "                 Truck       2244        333      0.923      0.931      0.964      0.716\n",
      "                  Tram       2244        138      0.873      0.942      0.948      0.637\n",
      "            Pedestrian       2244       1286      0.853      0.688      0.778      0.405\n",
      "        Person_sitting       2244         89      0.687      0.543      0.636      0.314\n",
      "               Cyclist       2244        496      0.929      0.741      0.847       0.47\n",
      "                  Misc       2244        284      0.923       0.75      0.843      0.538\n",
      "Speed: 0.1ms pre-process, 1.0ms inference, 1.1ms NMS per image at shape (32, 3, 640, 640)\n",
      "Results saved to \u001b[1mruns/val/exp12\u001b[0m\n"
     ]
    }
   ],
   "source": [
    "# data为之前训练用的东西的路径\n",
    "command_test = f\" \\\n",
    "python val.py \\\n",
    "--data data/kitti.yaml \\\n",
    "--weights {model_name} \\\n",
    "--task test \\\n",
    "\"\n",
    "!{command_test}\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ded85f62-da57-4b42-ac11-9fe326b1409d",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8ed29c33-4890-49dd-9989-b4f207a02ae0",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "b8e44a68-894a-4f0d-b68b-f439fe607619",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Test set updated successfully!\n",
      "\u001b[34m\u001b[1mval: \u001b[0mdata=data/kitti.yaml, weights=['e_base_s_16e.pt'], batch_size=32, imgsz=640, conf_thres=0.001, iou_thres=0.6, max_det=300, task=test, device=, workers=8, single_cls=False, augment=False, verbose=False, save_txt=False, save_hybrid=False, save_conf=False, save_json=False, project=runs/val, name=exp, exist_ok=False, half=False, dnn=False\n",
      "YOLOv5 🚀 5acf9a1c Python-3.10.8 torch-2.1.2+cu118 CUDA:0 (NVIDIA GeForce RTX 3080, 20181MiB)\n",
      "\n",
      "Fusing layers... \n",
      "YOLOv5s_kitti summary: 157 layers, 7031701 parameters, 0 gradients, 15.8 GFLOPs\n",
      "\u001b[34m\u001b[1mtest: \u001b[0mScanning /root/autodl-tmp/datasets/kitti/labels/test... 2244 images, 0 bac\u001b[0m\n",
      "\u001b[34m\u001b[1mtest: \u001b[0mNew cache created: /root/autodl-tmp/datasets/kitti/labels/test.cache\n",
      "                 Class     Images  Instances          P          R      mAP50   \n",
      "                   all       2244      12198      0.864      0.787      0.856      0.552\n",
      "                   Car       2244       8711      0.914      0.881      0.946      0.695\n",
      "                   Van       2244        861      0.885      0.825      0.899      0.639\n",
      "                 Truck       2244        333      0.928      0.925      0.959      0.711\n",
      "                  Tram       2244        138      0.847      0.949      0.946      0.625\n",
      "            Pedestrian       2244       1286      0.845      0.672       0.77      0.399\n",
      "        Person_sitting       2244         89      0.709      0.548      0.647      0.335\n",
      "               Cyclist       2244        496      0.909      0.748      0.844      0.476\n",
      "                  Misc       2244        284      0.873       0.75       0.84      0.536\n",
      "Speed: 0.1ms pre-process, 0.9ms inference, 1.2ms NMS per image at shape (32, 3, 640, 640)\n",
      "Results saved to \u001b[1mruns/val/exp13\u001b[0m\n",
      "Test set val successfully!\n"
     ]
    }
   ],
   "source": [
    "test_strength = 0.6\n",
    "model_name = 'e_base_s_16e'\n",
    "model = f'{model_name}.pt'\n",
    "\n",
    "update_testsets = f\" \\\n",
    "rm ../datasets/kitti/images/test/* &&\\\n",
    "cp ../datasets/fogged/fogged_strength{test_strength}/* ../datasets/kitti/images/test/ && \\\n",
    "echo 'Test set updated successfully!' \\\n",
    "\" \n",
    "!{update_testsets}\n",
    "\n",
    "val_command = f\" \\\n",
    "python val.py \\\n",
    "--data data/kitti.yaml \\\n",
    "--weights {model} \\\n",
    "--task test &&\\\n",
    "echo 'Test set val successfully!' \\\n",
    "\" \n",
    "!{val_command}\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ef571fbb-06e9-4e3b-aa3d-081bc68b794f",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c4b52db4-20d1-4a0d-b2a6-2ecb6415e185",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "6f9f17bf-2526-441a-ae37-38e5668070ba",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Test set updated successfully!\n",
      "\u001b[34m\u001b[1mval: \u001b[0mdata=data/kitti.yaml, weights=['e_base_s_16e.pt'], batch_size=32, imgsz=640, conf_thres=0.001, iou_thres=0.6, max_det=300, task=test, device=, workers=8, single_cls=False, augment=False, verbose=False, save_txt=False, save_hybrid=False, save_conf=False, save_json=False, project=runs/val, name=exp, exist_ok=False, half=False, dnn=False\n",
      "YOLOv5 🚀 5acf9a1c Python-3.10.8 torch-2.1.2+cu118 CUDA:0 (NVIDIA GeForce RTX 3080, 20181MiB)\n",
      "\n",
      "Fusing layers... \n",
      "YOLOv5s_kitti summary: 157 layers, 7031701 parameters, 0 gradients, 15.8 GFLOPs\n",
      "\u001b[34m\u001b[1mtest: \u001b[0mScanning /root/autodl-tmp/datasets/kitti/labels/test... 2244 images, 0 bac\u001b[0m\n",
      "\u001b[34m\u001b[1mtest: \u001b[0mNew cache created: /root/autodl-tmp/datasets/kitti/labels/test.cache\n",
      "                 Class     Images  Instances          P          R      mAP50   \n",
      "                   all       2244      12198      0.734       0.19      0.215      0.135\n",
      "                   Car       2244       8711      0.915      0.266      0.328      0.243\n",
      "                   Van       2244        861      0.539      0.189      0.186       0.14\n",
      "                 Truck       2244        333      0.828     0.0631      0.096     0.0676\n",
      "                  Tram       2244        138          1     0.0554     0.0899     0.0623\n",
      "            Pedestrian       2244       1286      0.798      0.312      0.359      0.203\n",
      "        Person_sitting       2244         89      0.587      0.236      0.269      0.128\n",
      "               Cyclist       2244        496      0.798      0.198      0.218      0.134\n",
      "                  Misc       2244        284       0.41      0.197      0.172      0.103\n",
      "Speed: 0.0ms pre-process, 1.0ms inference, 1.0ms NMS per image at shape (32, 3, 640, 640)\n",
      "Results saved to \u001b[1mruns/val/exp14\u001b[0m\n",
      "Test set val successfully!\n"
     ]
    }
   ],
   "source": [
    "test_strength = 1.2\n",
    "model_name = 'e_base_s_16e'\n",
    "model = f'{model_name}.pt'\n",
    "\n",
    "update_testsets = f\" \\\n",
    "rm ../datasets/kitti/images/test/* &&\\\n",
    "cp ../datasets/fogged/fogged_strength{test_strength}/* ../datasets/kitti/images/test/ && \\\n",
    "echo 'Test set updated successfully!' \\\n",
    "\" \n",
    "!{update_testsets}\n",
    "\n",
    "val_command = f\" \\\n",
    "python val.py \\\n",
    "--data data/kitti.yaml \\\n",
    "--weights {model} \\\n",
    "--task test &&\\\n",
    "echo 'Test set val successfully!' \\\n",
    "\" \n",
    "!{val_command}\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2d2f160f-19fb-4378-ba69-6984a91c7cae",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
